package offer;

public class Solution56_II {
    public int singleNumber(int[] nums) {
        int res = 0;
        for (int i = 0; i < 32; i++) {
            int n = 0;
            for (int num : nums) {
                if ((num & (1 << i)) != 0) {
                    n++;
                }
            }
            if (n % 3 == 1) {
                res |= (1 << i);
            }
        }
        return res;
    }
}
